# coding=utf-8
from rest_framework.request import Request


def ip_address(request, default=""):
    if not request:
        return default
    return request.META['REMOTE_ADDR'] or default


def user_agent(request, default=""):
    if not request:
        return default
    return request.META.get('HTTP_USER_AGENT') or default


def device_id(request, default=""):
    if not request:
        return default
    return request.META.get('HTTP_DID') or default
